Skip to content

Instantly share code, notes, and snippets.

import * as apigw from 'aws-cdk-lib/aws-apigateway';
import * as cdk from 'aws-cdk-lib';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as nodeLambda from 'aws-cdk-lib/aws-lambda-nodejs';
import * as path from 'path';
import * as s3 from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';
import * as apigw from 'aws-cdk-lib/aws-apigateway';
import * as cdk from 'aws-cdk-lib';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as nodeLambda from 'aws-cdk-lib/aws-lambda-nodejs';
import * as path from 'path';
import * as s3 from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';
@nitinp14920914
nitinp14920914 / chatbot_verbal.py
Created May 19, 2020 05:48
Voice Chatbot in Python using Speech Recognition, NLTK, Google Text-to-Speech & Scikit-learn
#sudo apt-get install portaudio19-dev python-all-dev python3-all-dev
#sudo apt-get install portaudio19-dev
#pip install SpeechRecognition numpy gTTs sklearn
#pip install gTTS
#sudo apt-get install mpg123
import io
import random
import string
import warnings
@IlmariKu
IlmariKu / henkilotunnus.js
Created April 2, 2024 11:31
Henkilötunnus 2023 regex - new finnish social security number regex to identify
// Henkilötunnus 2023 regex - new finnish social security, regex to identify potential numbers
// Does not actually validate using the checksum
// Allows for case-insensitivity using the /i in the end.
// Includes test variables and tests, just copy the old-form regex or new one
const oldSsnRegex = /^(\d{6}[-+A]\d{3}\S{1})$/i;
/** Compatible with old-form */
const newSsnRegex = /^(\d{6}[a-zA-Z]\d{3}\S{1})$/i;
/** Old-form social security numbers
import * as cdk from 'aws-cdk-lib';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as s3 from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';
import { RemovalPolicy } from 'aws-cdk-lib';
export interface StatefulStackProps extends cdk.StackProps {
bucketName: string;
}
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@phartenfeller
phartenfeller / Oracle Instant Client on Debian or Ubuntu
Last active May 20, 2024 11:49
Install an oracle instant client on a Debian or Ubuntu linux
apt-get install -y libaio1 alien
# Change version based on https://www.oracle.com/de/database/technologies/instant-client/linux-x86-64-downloads.html
# Example alternative: http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.5-basiclite-19.5.0.0.0-1.x86_64.rpm
wget http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.6-basic-19.6.0.0.0-1.x86_64.rpm
sudo alien -i --scripts oracle-instantclient*.rpm
rm -f oracle-instantclient*.rpm
# Optionally install SQLPlus
wget http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.6-sqlplus-19.6.0.0.0-1.x86_64.rpm
sudo alien -i --scripts oracle-instantclient*.rpm
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { EnvironmentConfig } from '../pipeline-types/pipeline-types';
import { StatefulStack } from '../../app/stateful/stateful-stack';
import { StatelessStack } from '../../app/stateless/stateless-stack';
// this is our stage made up of multiple stacks which will be deployed to various environments
// based on config i.e. feature-dev, staging, prod, which also includes our application config
export class PipelineStage extends cdk.Stage {
export interface EnvironmentConfig {
env: {
account: string;
region: string;
};
stageName: string;
stateful: {
bucketName: string;
};
stateless: {